package com.x.bff.app.service.common;

import cn.hutool.core.util.StrUtil;
import com.x.core.constant.Constants;
import org.springframework.stereotype.Service;

@Service
public class RedisKeyServiceImpl implements RedisKeyService {
    private static final String KEY_PREFIX = "app";

    private static final String FULL_KEY = KEY_PREFIX + ":{}";

    private static final String CUSTOMER_RESUME_RECOMMEND_LIST_KEY = "Customer:Resume:Recommend:List:Customer:Id{}:Gender:{}";
    public static final String CUSTOMER_RESUME_RECOMMEND_LIST_READ_CURSOR_KEY = "Customer:Resume:Recommend:List:Read:Cursor:Customer:Id{}";


    private String getFullKey(CharSequence keyTemplate, Object... params){
        return StrUtil.format(FULL_KEY, StrUtil.format(keyTemplate, params));
    }

    @Override
    public String getCustomerResumeRecommendListKey(long customerId, Integer gender) {
        return getFullKey(CUSTOMER_RESUME_RECOMMEND_LIST_KEY, customerId, gender);
    }

    @Override
    public String getCustomerResumeRecommendListReadCursorKey(Long customerId) {
        return getFullKey(CUSTOMER_RESUME_RECOMMEND_LIST_READ_CURSOR_KEY, customerId);
    }
}
